import { ref } from 'vue'

export default function userHook () {

  function getCode () {
    return new Promise((resolve, reject) => {
      uni.login({
        provider: 'weixin',
        success: function (res) {
          resolve(res.code)
        },
        fail: function (err) {
          reject(err)
        },
      })
    })
  }

  return {
    getCode
  }
}
